<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.lrkj.back.entity.ZsEquip"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../../attr.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
<link rel="stylesheet" href="${ctx}/css/sapar.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/css/common.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/css/kkpager_blue.css" />
<script type="text/javascript" src="${ctx}/js/jquery.js"></script>
<script type="text/javascript" src="${ctx}/js/sapar.js"></script>
<script type="text/javascript" src="${ctx}/js/WdatePicker.js"></script>
<script type="text/javascript" src="${ctx}/assets/layer/layer.js"></script>
<script type="text/javascript" src="${ctx}/js/kkpager.min.js"></script>
<script type="text/javascript" src="${ctx}/assets/laydate/laydate.js"></script>

<title>包发放统计</title>
<style  type="text/css">
.fafang{
margin-left:10px;
}
#weifa{
color:red;
font-weight:bold;
}
#yifa{
color:green;
font-weight:bold;
}
.tab{
background-color:white;
}
#suoyouqixie{
width:98%;
height:auto;
border:1px solid blue;
line-height:30px;
}
#tijiao{
width:70px;
height:50px;
background-color:green;
color:white;
}
#qixiexuanze{
width:95%;
}
#txt{
margin-top: -4px;
}
#txt1{
margin-top: 4px;
}
.shushu{
color:green;
font-weight:bold;
text-align:center;
}
#timelx{
  height: 22px;
  width:130px;
}
#chazhaozhi{
margin-left:10px;
}
#shijian{
border:1px solid re;
margin-left:20px;
}
.first{

border:1px solid red;
margin-left:30px;
}
.nav_list{float:left}
.nav_list ul{float:left}
.nav_list ul li{float:left;padding: 0 10px;height: 30px;;line-height: 30px;font-size: 14px;color: #333}
.nav_list ul li.native{background-color:#6ab96e;color: #fff
}
#zongshu{
height: 26px;
}
th{
text-align: center;
}
td{
text-align: center;
}	
#wcz{
color: red;
}
#aa{
float: left;
}
</style>
</head>
<body>
	<div id="saper-container">
			<div class="subfiled clearfix">
				<h2>包发放统计</h2>
			</div>
		<div class="subfiled-content">
				<div class="search-box clearfix">
					<div class="kv-item clearfix" id="txt">
						<label>搜索条件：</label>
						<div class="kv-item-content" id="txt1">
							<input type="text" name="searchTxt" placeholder="包名/科室/发放人" class="search_text" value="${tiaojian }"  onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')">
						</div>
					</div>
					<div class="kv-item clearfix">
                        
                        <div class="kv-item-content">
                            <span>&nbsp;&nbsp;&nbsp;起始时间:</span>
                        	<input type="text" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" id="st" name="startTime" value="<fmt:formatDate value='${st}' type='date' pattern='yyyy-MM-dd HH:mm:ss'/>" readonly="readonly"/>
                        	<span>&nbsp;&nbsp;&nbsp;终止时间:</span>
                        	<input type="text" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" id="et" name="endTime" value="<fmt:formatDate value='${et}' type='date' pattern='yyyy-MM-dd HH:mm:ss'/>" readonly="readonly"/>
                        </div>
                    </div>
                    <div id="aa"><a href="javascript:;" class="sapar-btn sapar-btn-recom query-btn" id="chaxun">查询</a></div>
					<div id="aa">&nbsp;&nbsp;&nbsp;包总数：<input type="text" name="total" value="${totalNum }"  readonly="readonly" id="zongshu"></div>
					<div id="aa"><a href="javascript:;" class="sapar-btn sapar-btn-recom query-btn" id="daochu">导出</a></div>
				</div>
				
                <div class="tab-content-item">
                <div class="table">
					<div class="table-box">
						<table>
							<thead>
								<tr>
								    <th>包条码</th>
									<th>包名</th>
									<th>包价格(元)</th>
									<th>发放科室</th>
									<th>发放人</th>
                                    <th>发放时间</th>
								</tr>
							</thead>
							<tbody>
								<c:if test="${packageinformationList != null }">
									<c:forEach items="${packageinformationList }" var="packageInformation">
										<tr>
											<td>${packageInformation.packageTiaoma }</td>
											<td>${packageInformation.tbPackageMuban.packageName}</td>
											<td>${packageInformation.tbPackageMuban.packagePrice}</td>
											<td>
											    <c:if test="${packageInformation.tbPackageMuban.tbDepartment != null }">${packageInformation.tbPackageMuban.tbDepartment.departmentName}</c:if>
											    <c:if test="${packageInformation.tbPackageMuban.tbDepartment == null }">——</c:if>
											</td>
											<td>${emMap[packageInformation.fafangrenTiaoma]}</td>
											<td><fmt:formatDate value="${packageInformation.fafangTime}"
													type="date" pattern="yyyy-MM-dd HH:mm:ss" /></td>
										</tr>
									</c:forEach>
								</c:if>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
				<!--表格结束-->
        <div id="saper-ft">
            <div id="kkpager"></div>
        </div>
</body>
<script type="text/javascript">
	$(function() {
		var starttime=$("#st").val();
		var endtime=$("#et").val();
		var tiaojian=$(".search_text").val();
		var totalPage = ${total};
		var pageNo = getParameter('pageIndex');
		if(!pageNo){
			pageNo = 1;
		}
		//生成分页
		//有些参数是可选的，比如lang，若不传有默认值
		kkpager.generPageHtml({
			pno : pageNo,
			//总页码
			total : totalPage,
			//链接前部
			hrefFormer : '${ctx}/tongji/baofafangtongji',
			//链接尾部
			hrefLatter : '.do',
			getLink : function(n){
				return this.hrefFormer + this.hrefLatter + "?pageIndex="+n+"&searchTxt="+$(".search_text").val()+"&tiaojian="+tiaojian+"&startTime="+starttime+"&endTime="+endtime;
			}
		});
		
		$("#chaxun").click(function() {
			tiaojian=$(".search_text").val();
			starttime=$("#st").val();
			endtime=$("#et").val();
	        var start=new Date(starttime.replace("-", "/").replace("-", "/"));  
	        var end=new Date(endtime.replace("-", "/").replace("-", "/"));  
	        if(end<start){  
	           alert("终止时间不能在起始时间之前");  
	        } 
		    window.location.href = "${ctx}/tongji/baofafangtongji.do?tiaojian="+tiaojian+"&startTime="+starttime+"&endTime="+endtime;
		});
		
		$("#daochu").click(function(){
			tiaojian=$(".search_text").val();
			starttime=$("#st").val();
			endtime=$("#et").val();
	        var start=new Date(starttime.replace("-", "/").replace("-", "/"));  
	        var end=new Date(endtime.replace("-", "/").replace("-", "/"));  
	        if(end<start){  
	           alert("终止时间不能在起始时间之前");  
	        } 
	        window.location.href="${ctx}/tongji/baofafangdaochu.do?tiaojian="+tiaojian+"&startTime="+starttime+"&endTime="+endtime;
		});
	});
    function getParameter(name) { 
		var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); 
		var r = window.location.search.substr(1).match(reg); 
		if (r!=null) return unescape(r[2]); return null;
  	} 
</script>
</html>